:root {
    --bg-color: #f7f7f8;
    --sidebar-bg: #ffffff;
    --main-bg: #ffffff;
    --border-color: #e5e7eb;
    --text-color: #111827;
    --text-secondary: #6b7280;
    --primary-color: #16a34a;
    --primary-hover: #15803d;
    --input-bg: #f9fafb;
}

* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 14px;
}

.container {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 320px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.logo {
    padding-bottom: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
}

.api-key-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group { margin-bottom: 16px; }
label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 13px; }

input[type="password"], select, textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    background-color: var(--input-bg);
}
textarea { resize: vertical; }

.image-drop-zone {
    border: 1px dashed var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background-color: var(--input-bg);
}
.image-drop-zone:hover { border-color: var(--primary-color); }
#image-preview { max-width: 100%; max-height: 100%; object-fit: contain; }
#upload-placeholder { color: var(--text-secondary); }

.prompt-modules, .param-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.prompt-modules button, .param-selector button {
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 6px 10px;
    border-radius: 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}
.prompt-modules button:hover, .param-selector button:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}
.param-selector button.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

#generate-btn {
    width: 100%;
    padding: 10px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: auto; /* Pushes button to the bottom */
}
#generate-btn:hover { background-color: var(--primary-hover); }
#generate-btn:disabled { background-color: #9ca3af; cursor: not-allowed; }

.output-panel {
    flex-grow: 1;
    background-color: var(--main-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    position: relative;
    padding: 20px;
}

#result-image-wrapper { width: 100%; text-align: center; }
#result-image { max-width: 100%; max-height: calc(100vh - 200px); border-radius: 4px; }
.result-url-container { display: flex; margin-top: 15px; }
#result-url { flex-grow: 1; border-right: none; border-radius: 4px 0 0 4px; }
#copy-url-btn { border-radius: 0 4px 4px 0; background-color: #e5e7eb; border: 1px solid var(--border-color); cursor: pointer; }
#copy-url-btn:hover { background-color: #d1d5db; }

.hidden { display: none; }
.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border-left-color: var(--text-secondary);
    animation: spin 1s ease infinite;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.error { color: #b91c1c; background-color: #fee2e2; border: 1px solid #fca5a5; padding: 15px; border-radius: 4px; text-align: center; }
